package com.indusfo.spc.client.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.indusfo.spc.client.pojo.ClientAnoDetail;

/**
 * 客户端不良明细
 * 
 * @author zhengd
 *
 */
public interface ClientAnoDetailMapper {
	/**
	 * 根据批号查询所有不良明细
	 * 
	 * @param batchId
	 * @return ClientAnoDetail
	 */
	List<ClientAnoDetail> queryClientAnoDetail(@Param("batchId") Integer batchId);

	/**
	 * 保存不良现象
	 * 
	 * @param ClientAnoDetail
	 * @return Integer
	 */
	Integer insertClientAnoDetail(List<ClientAnoDetail> list);

	/**
	 * 保存不良原因和对策
	 * 
	 * @param ClientAnoDetail
	 * @return Integer
	 */
	Integer saveClientAnoDetail(ClientAnoDetail clientAnoDetail);

	/**
	 * 查询是否有未完成的不良现象
	 * 
	 * @param clientAnoId
	 * @return Integer
	 */
	Integer queryCountByClientAnoId(@Param("clientAnoId") Integer clientAnoId);

	/**
	 * 查询未完成的不良现象
	 * 
	 * @param clientAnoId
	 * @return
	 */
	List<Integer> queryBadphenoIdByClientAnoId(@Param("clientAnoId") Integer clientAnoId);

	/**
	 * 根据异常单ID查询明细
	 * 
	 * @param clientAnoDetail
	 * @return
	 */
	List<ClientAnoDetail> selectClientAnoDetail(ClientAnoDetail clientAnoDetail);

	/**
	 * 根据异常单ID查询明细(计数)
	 * 
	 * @param clientAnoDetail
	 * @return
	 */
	int countClientAnoDetail(ClientAnoDetail clientAnoDetail);

	/**
	 * 停用启用删除
	 * 
	 * @param clientAnoDetailIds
	 * @param dataState
	 * @return
	 */
	int definedClientAnoDetail(@Param("clientAnoDetailIds") Long[] clientAnoDetailIds,
			@Param("dataState") Integer dataState);

	/**
	 * 新增
	 * 
	 * @param clientAnoDetail
	 * @return
	 */
	int insertSelective(ClientAnoDetail clientAnoDetail);

	/**
	 * 修改
	 * 
	 * @param clientAnoDetail
	 * @return
	 */
	int updateByPrimaryKeySelective(ClientAnoDetail clientAnoDetail);
	// 计算是否还有未处理的不良现象
    int judgeAnoState(ClientAnoDetail clientAnoDetail);
}
